ML Has Principal Typings
نویسندگان
چکیده
Is there a type system for core-ML that, using exactly the same syntax of types of the Damas-Milner system, types exactly the same terms of this system, and has principal typings? In this article we answer this question affirmatively. A definition of principal typing is given, capturing the simple idea of representing the set of all typings that can be obtained in derivations for a given term in a given type system. This definition is parameterised on an ordering on types, enabling it to be used for different type systems. A type system for core-ML is presented that uses type expressions with the same form as the Damas-Milner system, and considers as well-typed the same expressions of the Damas-Milner system. A type inference algorithm is then presented, which computes principal typings with respect to the given type system.
منابع مشابه
What Are Principal Typings and What Are They Good For? Technical Memorandum Mittlcsstmm532
We demonstrate the pragmatic value of the principal typing property, a property more general than ML's principal type property, by studying a type system with principal typings. The type system is based on rank 2 intersection types and is closely related to ML. Its principal typing property provides elegant support for separate compilation, including \smartest recompilation" and incremental typ...
متن کاملSound and complete inter-checking The very essence of principal typings
This paper brings together the two notions of inter-checking and principal typing , due in their more general formulation to Cardelli and Wells, respectively. Despite a deep interconnection between these two notions is commonly recognized, this is the first attempt at rigorously studying and establishing a relation between them. To this aim, we formalize the notion of sound and complete inter-c...
متن کاملPrincipality and type inference for intersection types using expansion variables
Principality of typings is the property that for each typable term, there is a typing from which all other typings are obtained via some set of operations. Type inference is the problem of finding a typing for a given term, if possible. We define an intersection type system which has principal typings and types exactly the strongly normalizable λ-terms. More interestingly, every finite-rank res...
متن کاملThe Essence of Principal Typings
Let S be some type system. A typing in S for a typable term M is the collection of all of the information other than M which appears in the final judgement of a proof derivation showing that M is typable. For example, suppose there is a derivation in S ending with the judgement A ` M : τ meaning that M has result type τ when assuming the types of free variables are given by A. Then (A, τ ) is a...
متن کاملPrincipal Typings and True Rank 2 Intersection Typable Recursive Definitions
We propose new typing rules for assigning rank 2 intersection types to (possibly mutually) recursive definitions. A major achievement of the new rules over previous proposals is that they allow to type also true rank 2 intersection typable recursive definitions (i.e., recursive definitions that have a rank 2 intersection type and no simple type). A notable feature of these rules is that they re...
متن کامل